'use strict';

/**
 * Module dependencies.
 */
var mongoose = require('mongoose'),
	Schema = mongoose.Schema;

/**
 * GroupManagement Schema
 */
var GroupManagementSchema = new Schema({
	title: {
		type: String,
		default: '',
		trim: true,
		required: 'Title cannot be blank'
	},
	captain: {
		type: Schema.ObjectId,
		ref: 'User'
	},
	members: [{	
		member: {
			type: Schema.ObjectId,
			ref: 'User'
		},
		JoinedOn: {
			type: Date,
			default: Date.now
		}
	}],
	created: {
		type: Date,
		default: Date.now,
		required: 'Session should have created date'
	},
	createdBy: {
		type: Schema.ObjectId,
		ref: 'User'
	},
	isActive:Boolean
});

mongoose.model('GroupManagement', GroupManagementSchema);